import { defineStore } from 'pinia'

export const useAuthStore = defineStore(
  'auth',
  () => {
    const accessToken = ref<string>(null)

    const setToken = (token: string) => {
      accessToken.value = token
    }
    const resetToken = () => {
      accessToken.value = null
    }

    return {
      accessToken,
      setToken,
      resetToken,
    }
  },
  {
    persist: true,
  },
)
